<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html">
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
	</head>

	<body erke-hide>
	</body>
	<script>
	 /**
 * @param {string} S
 * @return {number[][]}
 */
var largeGroupPositions = function(S) {
    var res=[];
    S=S.split('');
    var now=S[0];
    var len=1;
    var strat=0;
    for(var i=1;i<S.length;i++){
    	if(S[i]==now){
    		len++;
    	}else{
    		if(len>=3){
    			res.push([strat,i-1]);
    		};
    		strat=i;
    		now=S[i];
    		len=1;
    	};
    };
    if(len>=3){
		res.push([strat,S.length-1]);
	};
    console.log(res);
    return res;
};
res = new largeGroupPositions( "abcdddeeeeaabbbcdd");
	</script>

</html>